package com.ttwl.www.app.zhuanlan;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.ttwl.www.app.R;

/**
 * Created by Administrator on 2017/10/27 0027.
 */

public class zhuanlanAdapter extends RecyclerView.Adapter<zhuanlanAdapter.zhuanlanViewHolder> {
    private Context mContext;
    public zhuanlanAdapter(Context context){
        this.mContext = context;
    }
    @Override
    public zhuanlanAdapter.zhuanlanViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
//        return new zhuanlanViewHolder();
        return new zhuanlanViewHolder(LayoutInflater.from(mContext).inflate(R.layout.zhuanlan_item,parent,false));
    }

    @Override
    public void onBindViewHolder(zhuanlanAdapter.zhuanlanViewHolder holder, int position) {
        holder.zhuanlanT1.setText("预防蛀牙的有效措施");
        Glide.with(mContext).load("http://img1.imgtn.bdimg.com/it/u=4246156383,2668864790&fm=27&gp=0.jpg").into(holder.zhuanlan_cover);
    }

    @Override
    public int getItemCount() {
        return 30;
    }

    class zhuanlanViewHolder extends RecyclerView.ViewHolder{
        private  TextView zhuanlanT1;
        private ImageView zhuanlan_cover;

        public zhuanlanViewHolder(View itemView) {
            super(itemView);
            zhuanlanT1 = (TextView) itemView.findViewById(R.id.zhuanlanT1);
            zhuanlan_cover = (ImageView) itemView.findViewById(R.id.zhuanlan_cover);
        }
    }
}
